using System;
using System.Drawing;
using System.Windows.Forms;
class SimpleClock: Form
{
	public static void Main()
	{
		Application.Run(new SimpleClock());
	}
	public SimpleClock()
	{
		Text = "Simple Clock";
		BackColor = SystemColors.Window;
		ForeColor = SystemColors.WindowText;
		Timer timer = new Timer();
		timer.Tick += new EventHandler(TimerOnTick);
		timer.Interval = 1000;
		timer.Start();
	}
	private void TimerOnTick(object sender, EventArgs ea)
	{
		Invalidate();
	}
	protected override void OnPaint(PaintEventArgs pea)
	{
		Graphics grfx = pea.Graphics;
		DateTime dt = DateTime.Now;
		string strTime = dt.ToString("d") + "\n" + dt.ToString("T");
		SizeF sizef = grfx.MeasureString(strTime, Font);
		float fScale = Math.Min(ClientSize.Width / sizef.Width,
			ClientSize.Height / sizef.Height);
		Font font = new Font(Font.FontFamily,
			fScale * Font.SizeInPoints);
		StringFormat strfmt = new StringFormat();
		strfmt.Alignment = strfmt.LineAlignment =
			StringAlignment.Center;
		grfx.DrawString(strTime, font, new SolidBrush(ForeColor),
			ClientRectangle, strfmt);
	}
}